<template>
  <div>
    <div class="component-mainHeader">
      <div class="top">
        <div class="topleft">
          <p>
            <span class="iconfont" style="color:#1abc9a;margin-right:3px;">&#xe607;</span>
            {{title}}
          </p>
        </div>
        <div class="topright">
          <el-button type="info" @click="$router.go(-1)">
            <span style="font-weight:700;margin-right:5px;" class="iconfont">&#xe606;</span>返回
          </el-button>
        </div>
      </div>
    </div>
    <div class="contain senInfo">
      <div class="nav">项目详情</div>
      <ul>
        <li>
          <span>工单号：</span>
          <span>{{info.bmkRelevanceNo}}</span>
        </li>
        <li>
          <span>修补扩类型：</span>
          <span>{{info.bmkFixType}}</span>
        </li>
        <li>
          <span>所属单位：</span>
          <span>{{info.bmkOrg}}</span>
        </li>
        <li>
          <span>施工单位：</span>
          <span>{{info.bmkWorkteam}}</span>
        </li>
        <li>
          <span>片区：</span>
          <span>{{info.bmkArea}}</span>
        </li>
        <li>
          <span>镇区：</span>
          <span>{{info.bmkTown}}</span>
        </li>
        <li>
          <span>工单委派日期：</span>
          <span>{{info.entrustDate|timeFilter}}</span>
        </li>
        <li>
          <span>五级地址：</span>
          <span>{{info.bmkStation}}</span>
        </li>
        <li>
          <span>需求内容：</span>
          <span>{{info.bmkNeedContent}}</span>
        </li>
        <li>
          <span>施工队完工日期：</span>
          <span>{{info.finshDate|timeFilter}}</span>
        </li>
        <li>
          <span>选择施工队：</span>
          <span>
            <el-select v-model="chooseTeam" placeholder="请选择" clearable>
              <el-option
                v-for="item in team"
                :key="item.orgId"
                :label="item.orgName"
                :value="item.orgId"
              ></el-option>
            </el-select>
          </span>
        </li>
        <li>
          <span>备注信息：</span>
          <span>
            <span style="width:600px;text-align:left;">{{info.bmkNeedContent}}</span>
            <!-- <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="textarea"></el-input> -->
          </span>
        </li>
      </ul>
      <div class="btn">
        <button @click="subInfo()">确定</button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      title: "派单详情",
      info: {},
      // 下拉框的选中值
      chooseTeam:'',
      // 管道下拉框列表
      team: [],
     
      textarea: "" //备注信息
    };
  },
  created() {
    this.dataInit();
    console.log(this.$route.params.proId)
  },
  mounted() {},
  methods: {
    // 派单列表初始化 info & 下拉框数据
    dataInit() {
      let that = this,
        suCb = res => {
          console.log('派单信息查询',res);
          that.team = res.data.data.data.teamList;
          that.info = that.deepClone(res.data.data.data);
        },
        erCb = res => {
          console.log(res)
        },
        req = {
          url: "/api/web/proProject/queryBMKProDetailAndTeams",
          methods: "post",
          data: { proId: that.$route.params.proId },
          success: suCb,
          error: erCb
        };
        console.log('派单信息查询参数',req.data)
      that.$https(req);
    },
    // 提交派单信息
    subInfo() {
      let that = this,
        suCb = res => {
          console.log('派单提交结果',res);
          if (res.data.flag == 1) {
            that.$msg("派单成功！");
            this.$router.go(-1);
          } else {
            that.$erMsg('操作失败，网络错误')
          }
        },
        erCb = res => {
          
        },
        req = {
          url: "/api/web/proProject/dispatchProToTeam",
          methods: "post",
          data: {
            proId: that.$route.params.proId,
            orgId: that.chooseTeam,
            finshDate: that.info.finshDate
          },
          success: suCb,
          error: erCb
        };
      if (
        req.data.chooseTeam != ""
      ) {
        console.log('接单提交参数',req.data)
        that.$https(req);
      } else {
        that.$erMsg("请选择施工队！");
      }
    }
  },
  watch: {}
};
</script>
<style scoped>
.contain {
  width: 1100px;
  border: 1px solid #e4e4e4;
  color: #666;
  margin: 20px auto;
  box-sizing: border-box;
}
.contain .nav {
  background: #f3f3f3;
  padding-left: 20px;
  font-size: 14px;
  height: 40px;
  line-height: 40px;
  border-bottom: 1px solid #e4e4e4;
  text-align: left;
}
.contain ul {
  text-align: left;
  padding-left: 20px;
  font-size: 14px;
  padding-bottom: 20px;
}
.contain ul li {
  margin-top: 15px;
}
.contain ul li span:first-of-type {
  display: inline-block;
  width: 150px;
  text-align: right;
  margin-right: 10px;
  vertical-align: middle;
}
.el-checkbox-group {
  display: inline-block;
}
.el-textarea {
  width: 220px;
  vertical-align: middle;
}
.btn {
  text-align: left;
  padding-left: 150px;
  margin-bottom: 40px;
}
.btn button {
  width: 100px;
  height: 40px;
  background: #1abc9c;
  border: none;
  border-radius: 5px;
  color: #fff;
  font-size: 14px;
}
</style>
